File.open('in.ini') do |i| content = f.read puts content File.open('out.ini','w') do |o| out.write content.encode 'utf-8' end end